//
//  DetailViewController.m
//  08-UI
//
//  Created by Mars_ZXB on 16/7/25.
//  Copyright © 2016年 BAT3. All rights reserved.
//

#import "DetailViewController.h"
@interface DetailViewController ()
@end

@implementation DetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@", self.dictionary);
    self.view.backgroundColor = [UIColor whiteColor];
    UILabel *labelOfName = [[UILabel alloc] initWithFrame:CGRectMake(10, 50, 200, 30)];
    UILabel *labelOfGender = [[UILabel alloc] initWithFrame:CGRectMake(10, 90, 200, 30)];
    UILabel *labelOfPhoneNumber = [[UILabel alloc] initWithFrame:CGRectMake(10, 130, 200, 30)];
    UILabel *labelOfAge = [[UILabel alloc] initWithFrame:CGRectMake(10, 170, 200, 30)];
    
    labelOfName.text = [self.dictionary objectForKey:@"name"];
    labelOfGender.text = [self.dictionary objectForKey:@"gender"];
    labelOfAge.text = [NSString stringWithFormat:@"%@", [self.dictionary objectForKey:@"age"]];
    labelOfPhoneNumber.text = [NSString stringWithFormat: @"%@", [self.dictionary objectForKey:@"phoneNumber"]];
    
    [self.view addSubview:labelOfPhoneNumber];
    [self.view addSubview:labelOfAge];
    [self.view addSubview:labelOfGender];
    [self.view addSubview:labelOfName];

    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor redColor];
    button.frame = CGRectMake(10, 210, 200, 30);
    [self.view addSubview:button];
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(handleButton:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)handleButton:(UIButton *)button
{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
